// detectZoom.js
export const detectZoom = () => {
  let ratio = 0
  const screen = window.screen
  const ua = navigator.userAgent.toLowerCase()
  // if (window.devicePixelRatio !== undefined) {
  //   ratio = window.devicePixelRatio
  //   console.log('ratio1', ratio)
  //   console.log('window', window)
  //   console.log('devicePixelRatio', window.devicePixelRatio)
  // } 
  if (~ua.indexOf("msie")) {
    if (screen.deviceXDPI && screen.logicalXDPI) {
      ratio = screen.deviceXDPI / screen.logicalXDPI
    }
  } else if (
    window.outerWidth !== undefined &&
    window.innerWidth !== undefined
  ) {
    ratio = window.outerWidth / window.innerWidth
    console.log('outerWidth', window.outerWidth)
    console.log('innerWidth', window.innerWidth)
    console.log('ratio3', ratio)
  }
  if (ratio) {
    ratio = Math.round(ratio * 100)
  }
  return ratio
}
